//
//  PersonalViewController.m
//  BeautifulLockerRoom
//
//  Created by mac on 16/7/27.
//  Copyright © 2016年 Winny. All rights reserved.
//

#import "PersonalViewController.h"
#import "PersonalCollectionView.h"
#import "RequestTool.h"

@interface PersonalViewController ()
{
    
}
/***/
@property (nonatomic,strong)PersonalCollectionView * collectionView;
@end

@implementation PersonalViewController

-(PersonalCollectionView *)collectionView
{
    if (!_collectionView) {
        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
        [layout setScrollDirection:UICollectionViewScrollDirectionVertical];
        layout.itemSize = CGSizeMake(WINDOWWIDTH/2-4, WINDOWWIDTH/2 +WINDOWWIDTH / 4+40+30);
        layout.headerReferenceSize = CGSizeMake(WINDOWWIDTH, 0);
        layout.minimumLineSpacing = 2;
        layout.minimumInteritemSpacing = 2;
        layout.sectionInset = UIEdgeInsetsMake(2, 2, 2, 2);
        _collectionView = [[PersonalCollectionView alloc]initWithFrame:CGRectMake(0, 64, WINDOWWIDTH, WINDOWHEIGHT - 64 - 49) collectionViewLayout:layout];
        [RequestTool getPersonalDataWithBlock:^(NSMutableArray *array)
        {    _collectionView.dataArray = array;
            [_collectionView reloadData];
        }];
    }
    return _collectionView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"精选好货";
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.view addSubview:self.collectionView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
